package com.core.model.lxf;

import com.core.model.AbstractEntity;
import org.hibernate.annotations.*;

import javax.persistence.*;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: xianfei
 * Date: 2016-01-20
 * Time: 9:52
 * To change this template use Editor | File and Code Templates.
 */
@Entity
@Table(name = "good_type")
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class GoodType extends AbstractEntity {

    @Column(name = "type_name")
    private String typeName;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "goodType")
    //每次抓取10条GoodType对应的Good数据
    @BatchSize(size = 10)
    private List<Good> goods;

    public GoodType() {
    }

    public GoodType(String typeName) {
        this.typeName = typeName;
    }

    public String typeName() {
        return typeName;
    }

    public List<Good> goods() {
        return goods;
    }

    public void setGoods(List<Good> goods) {
        this.goods = goods;
    }
}
